package com.banmoon.datastructure.BinaryTree;

public class BinaryTreeTest {

    public static void main(String[] args) {
        // 创建一个空树
        BinaryTree tree = new BinaryTree();
        // 创建根节点
        BinaryTree.TreeNode node = new BinaryTree.TreeNode(1);
        tree.setRoot(node);
        // 设置左节点
        BinaryTree.TreeNode leftNode = new BinaryTree.TreeNode(2);
        node.setLeftNode(leftNode);
        BinaryTree.TreeNode node4 = new BinaryTree.TreeNode(4);
        BinaryTree.TreeNode node5 = new BinaryTree.TreeNode(5);
        leftNode.setLeftNode(node4);
        leftNode.setRightNode(node5);
        // 设置右节点
        BinaryTree.TreeNode rightNode = new BinaryTree.TreeNode(3);
        node.setRightNode(rightNode);
        BinaryTree.TreeNode node6 = new BinaryTree.TreeNode(6);
        BinaryTree.TreeNode node7 = new BinaryTree.TreeNode(7);
        rightNode.setLeftNode(node6);
        rightNode.setRightNode(node7);

        tree.delete(2);
        tree.frontShow();
    }
}
